package io.kiki.sba.registry.common.model.metaserver;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import lombok.Getter;
import lombok.Setter;


@Setter
@Getter
@JsonIgnoreProperties(ignoreUnknown = true)
public class ShutdownSwitch {

    private boolean shutdown = false;

    @JsonSetter(nulls = Nulls.SKIP)
    private String cause;

    public ShutdownSwitch() {
    }

    public ShutdownSwitch(boolean shutdown) {
        this.shutdown = shutdown;
    }

    public ShutdownSwitch(boolean shutdown, String cause) {
        this.shutdown = shutdown;
        this.cause = cause;
    }

    public static ShutdownSwitch defaultSwitch() {
        return new ShutdownSwitch();
    }


    public enum CauseEnum {
        force("force"), self_adaption("self_adaption"),
        ;

        private String cause;

        CauseEnum(String cause) {
            this.cause = cause;
        }


        public String getCause() {
            return cause;
        }
    }
}
